/*
 * 
 * Version 1.00
 * 
 * Created on 2007-6-4
 * Encoding GB2312
 */
package net.comm.oper.service.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.List;
import java.util.Vector;

import net.comm.common.GlbFinal;
import net.comm.common.ReturnMessage;
import net.comm.common.common;


import net.comm.oper.bean.Baseoperlog;
import net.comm.oper.db.DbOperLogService;
import net.comm.oper.db.OperLogServiceSqlMysql;
import net.comm.oper.web.form.OperLogForm;
import net.comm.page.PageCtr;
import net.comm.param.service.impl.SequenceMgr;

import net.comm.tags.JstlFun;
import net.comm.util.DatetimeUtil;
import net.comm.util.DbcpPool;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.log4j.Logger;
import org.sakaiproject.db.impl.BasicSqlService;


/**
 *
 * @author hcgong(hcgong@sina.com)
 * @version 1.0
 * @date 2007-6-4
 */
public class OperLogServiceImpl {

	static Logger logger = Logger.getLogger(OperLogServiceImpl.class.getName());

	/**
	 * 
	 * @see net.IUserbasicService.module.other.IUserService
	 * 		#list(net.swift.module.other.ExaQueryBean, net.swift.common.ReturnMessage)
	 */
	public List list(OperLogForm theForm,  ReturnMessage msg) 
	{
		List list = null;

		Connection cn = null;

		try
		{
			cn = DbcpPool.getConnection();
			
			OperLogServiceSqlMysql servSql = new OperLogServiceSqlMysql();
			BasicSqlService  bSqlServ = new BasicSqlService();

			Object[] fields2 = new Object[1];
			
			fields2[0] = theForm.getMtime();

			String sql = servSql.getCountSql1();

			/**
			 * 根据SQL执行结果计算分页相关信息
			 */
			PageCtr page = theForm.getPage();
			page.setTotalNum(bSqlServ.dbCount(cn, sql, fields2));
			page.caculate();

			//取得FORM中传入的查询参数
			Object[] fields = new Object[3];
			
			fields[0] = theForm.getMtime();
			fields[1] = page.getPos()-1;
			fields[2] = page.getPageSize();
			
			sql = servSql.getRecbyPageSql();

	
			list = bSqlServ.dbRead(cn, sql, fields, new DbOperLogService());
			
		    DbcpPool.returnConnection(cn);
		    
		} catch(Exception ex) 
		{
			/**
			 * 记录相关日志
			 */
			logger.error(ex.getMessage());
			try 
			{
				DbcpPool.rollBackTran(cn);
				DbcpPool.closeTran(cn);
				DbcpPool.returnConnection(cn);
			} catch(Exception ex1) 
			{
				ex1.printStackTrace();
				logger.error("事务回滚操作失败!ExaServiceImpl->add(01)" , ex1);
			}			
			
		} finally {
			DbcpPool.returnConnection(cn);
		}		
		
		return list;
	}
	/**
	 * 
	 * @see net.IUserbasicService.module.other.IUserService
	 * 		#list(net.swift.module.other.ExaQueryBean, net.swift.common.ReturnMessage)
	 */
	public List adlist(OperLogForm theForm,  ReturnMessage msg) 
	{
		List list = new Vector();

		Connection cn = null;
		Statement stmt=null;
		ResultSet rs=null;
		try
		{
			cn = DbcpPool.getConnection();
			
			OperLogServiceSqlMysql servSql = new OperLogServiceSqlMysql();
			
			StringBuffer sb = new StringBuffer(" where 1=1 ");

			String QryType = theForm.getQryType().replaceAll(GlbFinal.SQLINjection, " ");
			if(!QryType.equals("")){
				
				sb.append(" and type in (");
				sb.append(QryType);
				sb.append(") ");
			}

			sb.append(" Order by MTime desc ");
			
			//查询记录数
			stmt = cn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
			String sql = servSql.getCountSql1();

			logger.debug(sql+sb.toString());
			rs=stmt.executeQuery(sql+sb.toString());
			int nRows = 0;
			if (rs.next())
	           nRows = rs.getInt("COUNT");
			else
			{
	            rs.close();
	            stmt.close();
	            DbcpPool.returnConnection(cn);
			    return list;
			}
			/**
			 * 根据SQL执行结果计算分页相关信息
			 */
			PageCtr page = theForm.getPage();
			page.setTotalNum(nRows);
			page.caculate();

			sb.append(" limit ");
			sb.append(page.getPos()-1);
			sb.append(", ");
			sb.append(page.getPageSize());
			
			 //取记录
			 sql = servSql.getRecSql();
			 logger.debug(sql+sb.toString());
			 DbOperLogService dbuser = new DbOperLogService();
			 
			 rs=stmt.executeQuery(sql+sb.toString());
			 while (rs.next())
			 {
				try
				{
					Object obj = dbuser.readSqlResultRecord(rs);
					if (obj != null) list.add(obj);
				}
				catch (Throwable t)
				{
					logger.error(t.getMessage());
				}		
			 }
			 rs.close();
			 stmt.close();
		     DbcpPool.returnConnection(cn);

		} catch(Exception ex) 
		{
			/**
			 * 记录相关日志
			 */
			logger.error(ex.getMessage());
			try {
				if (rs != null)
					rs.close();
				if (stmt != null)
					stmt.close();
				DbcpPool.returnConnection(cn);
			} catch (Exception ex1) {
				ex1.printStackTrace();
			}			
	    }finally {
			try {
				if (rs != null)
					rs.close();
				if (stmt != null)
					stmt.close();
			} catch (Exception ex) {
				ex.printStackTrace();
			}			
			DbcpPool.returnConnection(cn);
		}		
		return list;
	}		
	/**
	 * 
	 * @see net.IUserbasicService.module.other.IUserService
	 * 		#list(net.swift.module.other.ExaQueryBean, net.swift.common.ReturnMessage)
	 */
	public List friendlist(OperLogForm theForm,  ReturnMessage msg) 
	{
		List list = null;

		Connection cn = null;

		try
		{
			cn = DbcpPool.getConnection();
			
			OperLogServiceSqlMysql servSql = new OperLogServiceSqlMysql();
			BasicSqlService  bSqlServ = new BasicSqlService();

			//取得FORM中传入的查询参数
			Object[] fields2 = new Object[1];
			
			fields2[0] = theForm.getQryUserID();

			String sql = servSql.getCountSql2();

			/**
			 * 根据SQL执行结果计算分页相关信息
			 */
			PageCtr page = theForm.getPage();
			page.setTotalNum(bSqlServ.dbCount(cn, sql, fields2));
			page.caculate();

			//取得FORM中传入的查询参数
			Object[] fields = new Object[3];
			
			fields[0] = theForm.getQryUserID();
			fields[1] = page.getPos()-1;
			fields[2] = page.getPageSize();
			
			sql = servSql.getRecbyFriendIDSql();

			list = bSqlServ.dbRead(cn, sql, fields, new DbOperLogService());
			
		    DbcpPool.returnConnection(cn);
		    
		} catch(Exception ex) 
		{
			/**
			 * 记录相关日志
			 */
			logger.error(ex.getMessage());
			try 
			{
				DbcpPool.rollBackTran(cn);
				DbcpPool.closeTran(cn);
				DbcpPool.returnConnection(cn);
			} catch(Exception ex1) 
			{
				ex1.printStackTrace();
				logger.error("事务回滚操作失败!ExaServiceImpl->add(01)" , ex1);
			}			
			
		} finally {
			DbcpPool.returnConnection(cn);
		}		
		
		return list;
	}
	/**
	 * 
	 * @see net.IUserbasicService.module.other.IUserService
	 * 		#list(net.swift.module.other.ExaQueryBean, net.swift.common.ReturnMessage)
	 */
	public List linjulist(OperLogForm theForm,  ReturnMessage msg) 
	{
		List list = null;

		Connection cn = null;

		try
		{
			cn = DbcpPool.getConnection();
			
			OperLogServiceSqlMysql servSql = new OperLogServiceSqlMysql();
			BasicSqlService  bSqlServ = new BasicSqlService();

			//取得FORM中传入的查询参数
			Object[] fields2 = new Object[1];
			
			fields2[0] = theForm.getQryUserID();

			String sql = servSql.getCountSql3();

			/**
			 * 根据SQL执行结果计算分页相关信息
			 */
			PageCtr page = theForm.getPage();
			page.setTotalNum(bSqlServ.dbCount(cn, sql, fields2));
			page.caculate();

			//取得FORM中传入的查询参数
			Object[] fields = new Object[3];
			
			fields[0] = theForm.getQryUserID();
			fields[1] = page.getPos()-1;
			fields[2] = page.getPageSize();
			
			sql = servSql.getRecbyLinjuIDSql();

			list = bSqlServ.dbRead(cn, sql, fields, new DbOperLogService());
			
		    DbcpPool.returnConnection(cn);
		    
		} catch(Exception ex) 
		{
			/**
			 * 记录相关日志
			 */
			logger.error(ex.getMessage());
			try 
			{
				DbcpPool.rollBackTran(cn);
				DbcpPool.closeTran(cn);
				DbcpPool.returnConnection(cn);
			} catch(Exception ex1) 
			{
				ex1.printStackTrace();
				logger.error("事务回滚操作失败!ExaServiceImpl->add(01)" , ex1);
			}			
			
		} finally {
			DbcpPool.returnConnection(cn);
		}		
		
		return list;
	}	
	/**
	 * 
	 * @see net.IUserbasicService.module.other.IUserService
	 * 		#list(net.swift.module.other.ExaQueryBean, net.swift.common.ReturnMessage)
	 */
	public List grouplist(OperLogForm theForm,  ReturnMessage msg) 
	{
		List list = null;

		Connection cn = null;

		try
		{
			cn = DbcpPool.getConnection();
			
			OperLogServiceSqlMysql servSql = new OperLogServiceSqlMysql();
			BasicSqlService  bSqlServ = new BasicSqlService();

			//取得FORM中传入的查询参数
			Object[] fields2 = new Object[1];
			
			fields2[0] = theForm.getQryUserID();

			String sql = servSql.getCountSql4();

			/**
			 * 根据SQL执行结果计算分页相关信息
			 */
			PageCtr page = theForm.getPage();
			page.setTotalNum(bSqlServ.dbCount(cn, sql, fields2));
			page.caculate();

			//取得FORM中传入的查询参数
			Object[] fields = new Object[3];
			
			fields[0] = theForm.getQryUserID();
			fields[1] = page.getPos()-1;
			fields[2] = page.getPageSize();
			
			sql = servSql.getRecbyGroupIDSql();

			list = bSqlServ.dbRead(cn, sql, fields, new DbOperLogService());
			
		    DbcpPool.returnConnection(cn);
		    
		} catch(Exception ex) 
		{
			/**
			 * 记录相关日志
			 */
			logger.error(ex.getMessage());
			try 
			{
				DbcpPool.rollBackTran(cn);
				DbcpPool.closeTran(cn);
				DbcpPool.returnConnection(cn);
			} catch(Exception ex1) 
			{
				ex1.printStackTrace();
				logger.error("事务回滚操作失败!ExaServiceImpl->add(01)" , ex1);
			}			
			
		} finally {
			DbcpPool.returnConnection(cn);
		}		
		
		return list;
	}	
	/**
	 * 
	 * @see net.IUserbasicService.module.other.IUserService
	 * 		#list(net.swift.module.other.ExaQueryBean, net.swift.common.ReturnMessage)
	 */
	public List shequlist(OperLogForm theForm,  ReturnMessage msg) 
	{
		List list = null;

		Connection cn = null;

		try
		{
			cn = DbcpPool.getConnection();
			
			OperLogServiceSqlMysql servSql = new OperLogServiceSqlMysql();
			BasicSqlService  bSqlServ = new BasicSqlService();

			//取得FORM中传入的查询参数
			Object[] fields2 = new Object[1];
			
			fields2[0] = theForm.getQryUserID();

			String sql = servSql.getCountSql5();

			/**
			 * 根据SQL执行结果计算分页相关信息
			 */
			PageCtr page = theForm.getPage();
			page.setTotalNum(bSqlServ.dbCount(cn, sql, fields2));
			page.caculate();

			//取得FORM中传入的查询参数
			Object[] fields = new Object[3];
			
			fields[0] = theForm.getQryUserID();
			fields[1] = page.getPos()-1;
			fields[2] = page.getPageSize();
			
			sql = servSql.getRecbyShequSql();

			list = bSqlServ.dbRead(cn, sql, fields, new DbOperLogService());
			
		    DbcpPool.returnConnection(cn);
		    
		} catch(Exception ex) 
		{
			/**
			 * 记录相关日志
			 */
			logger.error(ex.getMessage());
			try 
			{
				DbcpPool.rollBackTran(cn);
				DbcpPool.closeTran(cn);
				DbcpPool.returnConnection(cn);
			} catch(Exception ex1) 
			{
				ex1.printStackTrace();
				logger.error("事务回滚操作失败!ExaServiceImpl->add(01)" , ex1);
			}			
			
		} finally {
			DbcpPool.returnConnection(cn);
		}		
		
		return list;
	}	
	/**
	 * 返回根据会员ID查询的会员操作日志
	 */
	public List list(String  userID) 
	{
		List list = null;
		Connection cn = null;

		try
		{
			cn = DbcpPool.getConnection();
			
			//取得FORM中传入的查询参数
			Object[] fields = new Object[1];
			
			fields[0] = userID;			

			OperLogServiceSqlMysql servSql = new OperLogServiceSqlMysql();
						
			BasicSqlService  bSqlServ = new BasicSqlService();

			/*
			 * 获得查询SQL语句
			 */
			String sql = servSql.getByUserIDSql();
									
			list = bSqlServ.dbRead(cn, sql, fields, new DbOperLogService());
									
		    DbcpPool.returnConnection(cn);
		    
		} catch(Exception ex) 
		{
			/**
			 * 记录相关日志
			 */
			logger.error(ex.getMessage());
			try 
			{
				DbcpPool.rollBackTran(cn);
				DbcpPool.closeTran(cn);
				DbcpPool.returnConnection(cn);
			} catch(Exception ex1) 
			{
				ex1.printStackTrace();
				logger.error("事务回滚操作失败!ExaServiceImpl->add(01)" , ex1);
			}			
			
		} finally {
			DbcpPool.returnConnection(cn);
		}
		
		return list;
	}
	
	/**
	 * @see net.IUserbasicService.module.other.IUserService
	 * 		#get(net.swift.db.tab_paramnostro, net.swift.common.ReturnMessage)
	 */
	public void get(OperLogForm theForm, ReturnMessage msg) 
	{
		Connection cn = null;
		try
		{
			cn = DbcpPool.getConnection();
			List list = null;

			//取得FORM中传入的查询参数
			Object[] fields = new Object[1];
			
			fields[0] = theForm.getOperID();			
			
			OperLogServiceSqlMysql servSql = new OperLogServiceSqlMysql();
			
			BasicSqlService  bSqlServ = new BasicSqlService();
			
			String sql = servSql.getbykeySql();			
					
			list = bSqlServ.dbRead(cn, sql, fields, new DbOperLogService());
			
			if(list.size() ==0){
				common.setAppFailMsg(msg , " 取记录失败，请检查！");
				DbcpPool.closeTran(cn);
				DbcpPool.returnConnection(cn);
				return;				
			}
			
			Baseoperlog base = (Baseoperlog)list.get(0);
				
			BeanUtils.copyProperties(theForm, base);
			
			DbcpPool.returnConnection(cn);
			return;
			
		} catch(Exception ex) 
		{
			logger.error("System error , param get about invite" + ex);
			common.setAppFailMsg(msg , ex.getMessage());
			try 
			{
				DbcpPool.rollBackTran(cn);
				DbcpPool.closeTran(cn);
				DbcpPool.returnConnection(cn);
			} catch(Exception ex1) 
			{
				ex1.printStackTrace();
				logger.error("事务回滚操作失败!ExaServiceImpl->add(01)" , ex1);
			}			
		} finally {
			DbcpPool.returnConnection(cn);
		}
		
		return ;
	}
	/**
	 * 添加会员操作日志到表中
	 * @see net.IUserbasicService.module.other.IUserService#add(net.swift.common.ReturnMessage)
	 * arr说明
	 * 		arr[0] = theForm.getUserID();			//主操作者	
			arr[1] = "";							//主动者与被动者的关系副词例如：“和” 
			arr[2] = "";							//被动接受者ID 
			arr[3] = "";							//被动接受者姓名
			arr[4] = "发表了新话题：";				//操作
			arr[5] = theForm.getTitle();			//操作对象名称
			arr[6] = theForm.getGroupID() + "|" + theForm.getGForumID();//操作对象KEY，多个字段以'|'分隔
	 */
	public void add(Connection cn, OperLogForm theForm, ReturnMessage msg) 
	{
		try
		{
			
			//组装日志内容
			StringBuffer sb = new StringBuffer();
			
			String[] arr = theForm.getLogarr();
			if(arr == null || arr.length != 7){
				
				common.setAppFailMsg(msg , " 缺少日志内容！");
				DbcpPool.rollBackTran(cn);
				DbcpPool.closeTran(cn);
				DbcpPool.returnConnection(cn);
				return ;
			}		
			int type = theForm.getType();
			sb.append("<a href='" + GlbFinal.FOLDER_INSTALL + "/users_home/userID_" +  theForm.getUserID() + ".html'>" + arr[0] + "</a>");//主操作者

			sb.append(arr[1]);									//主动者与被动者的关系副词
			if(arr[2] != null && !arr[2].equals("")
					&&arr[3] != null && !arr[3].equals("")){
				sb.append("<a href='" + GlbFinal.FOLDER_INSTALL + "/users_home/userID_"
						+ arr[2]+".html'>" + arr[3] + "</a>");//被动接受者
			}
			sb.append(arr[4]);									//操作

			//根据操作板块 增加链接
			if(arr[5] != null && !arr[5].equals("")){
				if(arr[6] != null && !arr[6].trim().equals("")){
					
					String[] key = arr[6].split("\\|");
					String title = arr[5];
					if(arr[5].length() > 5){
						title = arr[5].substring(0,5);
					}
					switch (theForm.getType())
					{
					case GlbFinal.OPERTYPE_BLOG:			//日志
						if(key.length != 1){
							common.setAppFailMsg(msg , " 写日志记录动态失败！");
							DbcpPool.rollBackTran(cn);
							DbcpPool.closeTran(cn);
							DbcpPool.returnConnection(cn);
							return;
						}
						sb.append("<a title='");
						sb.append(arr[5]);					//操作对象名称和链接
						sb.append("' href='");
						sb.append(GlbFinal.FOLDER_INSTALL);
						sb.append("/blog_detail/blogID_");
						sb.append(key[0]);
						sb.append(".html'>");
						sb.append(title);					//操作对象名称和链接
						sb.append("</a>");
						break;					
					case GlbFinal.OPERTYPE_JIAHAOYOU:	//好友
						sb.append(arr[5]);				//操作对象名称和链接
						break;
					
					case GlbFinal.OPERTYPE_LINJU:		//加关注
						sb.append(arr[5]);				//操作对象名称和链接
						break;
					
					case GlbFinal.OPERTYPE_UPLOADPIC:	//上传照片
						if(key.length != 1){
							common.setAppFailMsg(msg , " 上传照片记录动态失败！");
							DbcpPool.rollBackTran(cn);
							DbcpPool.closeTran(cn);
							DbcpPool.returnConnection(cn);
							return;
						}
						sb.append("<a title='");
						sb.append(arr[5]);					//操作对象名称和链接
						sb.append("' href='");
						sb.append(GlbFinal.FOLDER_INSTALL);
						sb.append("/gpic_adlist");
						sb.append("/qryGAlbumID_");
						sb.append(key[0]);
						sb.append(".html'>");
						sb.append(arr[5]);					//操作对象名称和链接
						sb.append("</a>");
						break;
//					case GlbFinal.OPERTYPE_NOTADV:		//公告/通知/投诉/建议/留言
//						if(key.length != 1){
//							common.setAppFailMsg(msg , " 公告/通知/投诉/建议/留言记录动态失败！");
//							DbcpPool.rollBackTran(cn);
//							DbcpPool.closeTran(cn);
//							DbcpPool.returnConnection(cn);
//							return;
//						}
//						sb.append("<a href='");
//						sb.append(GlbFinal.FOLDER_INSTALL);
//						sb.append("/gpic_views");
//						sb.append("/gpicID_");
//						sb.append(key[0]);
//						sb.append(".html'>");
//						sb.append(arr[5]);					//操作对象名称和链接
//						sb.append("</a>");
//						break;
					case GlbFinal.OPERTYPE_HUATI:			//发布话题
						if(key.length != 1){
							common.setAppFailMsg(msg , " 发布话题记录动态失败！");
							DbcpPool.rollBackTran(cn);
							DbcpPool.closeTran(cn);
							DbcpPool.returnConnection(cn);
							return;
						}
						sb.append("<a title='");
						sb.append(arr[5]);					//操作对象名称和链接
						sb.append("' href='");
						sb.append(GlbFinal.FOLDER_INSTALL);
						sb.append("/gfollforum_list");
						sb.append("/qryGForumID_");
						sb.append(key[0]);
						sb.append(".html'>");
						sb.append(title);					//操作对象名称和链接
						sb.append("</a>");
						break;
					case GlbFinal.OPERTYPE_SQZL:			//发布社区资料
						if(key.length != 1){
							common.setAppFailMsg(msg , " 发布社区资料记录动态失败！");
							DbcpPool.rollBackTran(cn);
							DbcpPool.closeTran(cn);
							DbcpPool.returnConnection(cn);
							return;
						}
						sb.append("<a title='");
						sb.append(arr[5]);					//操作对象名称和链接
						sb.append("' href='");
						sb.append(GlbFinal.FOLDER_INSTALL);
						sb.append("/gfollforum_list");
						sb.append("/qryGForumID_");
						sb.append(key[0]);
						sb.append(".html'>");
						sb.append(title);					//操作对象名称和链接
						sb.append("</a>");
						break;
					case GlbFinal.OPERTYPE_HUODONG:		//发布活动
						if(key.length != 1){
							common.setAppFailMsg(msg , " 发布活动记录动态失败！");
							DbcpPool.rollBackTran(cn);
							DbcpPool.closeTran(cn);
							DbcpPool.returnConnection(cn);
							return;
						}
						sb.append("<a title='");
						sb.append(arr[5]);					//操作对象名称和链接
						sb.append("' href='");
						sb.append(GlbFinal.FOLDER_INSTALL);
						sb.append("/gparty_info");
						sb.append("/partyID_");
						sb.append(key[0]);
						sb.append(".html'>");
						sb.append(title);					//操作对象名称和链接
						sb.append("</a>");
						break;
					case GlbFinal.OPERTYPE_GALBUM:			//建立部落相册
					case GlbFinal.OPERTYPE_PERSONALBUM:		//建立个人相册
						if(key.length != 1){
							common.setAppFailMsg(msg , " 建立部落相册记录动态失败！");
							DbcpPool.rollBackTran(cn);
							DbcpPool.closeTran(cn);
							DbcpPool.returnConnection(cn);
							return;
						}
						sb.append("<a title='");
						sb.append(arr[5]);					//操作对象名称和链接
						sb.append("' href='");
						sb.append(GlbFinal.FOLDER_INSTALL);
						sb.append("/gpic_adlist");
						sb.append("/qryGAlbumID_");
						sb.append(key[0]);
						sb.append(".html'>");
						sb.append(arr[5]);					//操作对象名称和链接
						sb.append("</a>");
						break;
					default:
						break;
					}
				}else{
					sb.append(arr[5]);					//操作对象名称和链接
				}
			}
			//取得FORM中传入的查询参数
			Object[] fields = new Object[5];
			
			fields[0] = SequenceMgr.generateSeq(GlbFinal.SEQ_INITDATE, GlbFinal.SEQ_OPERLOG);			
			fields[1] = theForm.getUserID();
			fields[2] = theForm.getType();
			fields[3] = sb.toString();
			fields[4] = DatetimeUtil.getDatetime();
			
			OperLogServiceSqlMysql servSql = new OperLogServiceSqlMysql();
			BasicSqlService  bSqlServ = new BasicSqlService();
			
			String sql = servSql.getInsertSql();
						
			boolean  res = bSqlServ.dbWrite(cn, sql, fields);
			if(!res){
				common.setAppFailMsg(msg , " 登记操作日志失败！");
				DbcpPool.rollBackTran(cn);
				DbcpPool.closeTran(cn);
				DbcpPool.returnConnection(cn);
				return;
			}

		} catch(Exception ex) 
		{
			common.setAppFailMsg(msg , ex.getMessage());
			logger.error("System error , param get about operlog" + ex);
			try 
			{
				DbcpPool.rollBackTran(cn);
				DbcpPool.closeTran(cn);
				DbcpPool.returnConnection(cn);
			} catch(Exception ex1) 
			{
				ex1.printStackTrace();
				logger.error("事务回滚操作失败!ExaServiceImpl->add(01)" , ex1);
			}			
		}
		
		return;
	}

	/**
	 * 删除一条指定记录
	 * @see net.IUserbasicService.module.other.IUserService#update(net.swift.common.ReturnMessage)
	 */
	public void delete(OperLogForm theForm, ReturnMessage msg) 
	{
		
		Connection cn = null;
		try
		{
			cn = DbcpPool.getConnection();
			
			DbcpPool.beginTran(cn);

			//取得FORM中传入的查询参数
			Object[] fields = new Object[1];
			
			fields[0] = theForm.getOperID();
			
			OperLogServiceSqlMysql servSql = new OperLogServiceSqlMysql();
			BasicSqlService  bSqlServ = new BasicSqlService();
			String sql = servSql.getDeleteSql();
			
								
			boolean  res = bSqlServ.dbWrite(cn, sql, fields);
			if(res){
				common.setAppFailMsg(msg , " 更新记录失败，请检查！");
				DbcpPool.rollBackTran(cn);
				DbcpPool.closeTran(cn);
				DbcpPool.returnConnection(cn);
				return;
			}
			
			DbcpPool.commitTran(cn);
			DbcpPool.closeTran(cn);
			DbcpPool.returnConnection(cn);
			return;
			
		} catch(Exception ex) 
		{
			logger.error("System error , param get about invite" + ex);
			common.setAppFailMsg(msg , ex.getMessage());
			try 
			{
				DbcpPool.rollBackTran(cn);
				DbcpPool.closeTran(cn);
				DbcpPool.returnConnection(cn);
			} catch(Exception ex1) 
			{
				ex1.printStackTrace();
				logger.error("事务回滚操作失败!ExaServiceImpl->add(01)" , ex1);
			}			
		} finally {
			DbcpPool.returnConnection(cn);
		}
		
		return ;
	}

	/**
	 * 更新一条指定记录
	 * @see net.IUserbasicService.module.other.IUserService#update(net.swift.common.ReturnMessage)
	 */
	public void update(OperLogForm theForm, ReturnMessage msg) 
	{
		
		return ;
	}

}
